const path = require('path');

module.exports = {
  mode: 'production',
  entry: {
    main: "./main.js"
  },
  output: {
    path: path.join(__dirname, './dist'),
    filename: '[name]-[hash].js'
  },
  module: {
    rules: [
      {
        test: /\.css$/,
        loader: 'css-loader',
        options: {
          url: true
        }
      }
      ,
      {
        test: /\.(js)|(jsx)$/,
        exclude: /node_modules/,
        use: [
          {
            loader: path.resolve('./src/loader/loader.js'),
            options: {
              name: 'tony',
              time: '2020-03-01',
              desc: 'loader desc '
            }
          },
          {
            loader: 'babel-loader',
            options: {
              presets: ['@babel/preset-env', "@babel/preset-react"],
              plugins: ['@babel/plugin-transform-runtime']
            }
          }
        ]
      }
    ]
  }
}